using DG.Tweening;
using UnityEngine;
using static Minesweeper.GameStatic;

namespace Minesweeper
{
    public class Selection : MonoBehaviour
    {
        private Vector2 _recentPos;
        private void Update()
        {
            if (Paused)
                return;
        
            var pos = Floor(Camera.main.ScreenToWorldPoint(Input.mousePosition));
            if ((Vector2)transform.position != pos)
                transform.DOMove(pos, .1f).SetEase(Ease.OutSine);
        }
    
        private Vector2 Floor(Vector2 vec) => new(Mathf.Floor(vec.x + 0.5f), Mathf.Floor(vec.y + 0.5f));
    }
}
